<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: Spec::DSL::BehaviourCallbacks</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">Spec::DSL::BehaviourCallbacks</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/plugins/rspec/lib/spec/dsl/behaviour_callbacks_rb.html">
                vendor/plugins/rspec/lib/spec/dsl/behaviour_callbacks.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
See <a
href="http://rspec.rubyforge.org/documentation/before_and_after.html">rspec.rubyforge.org/documentation/before_and_after.html</a>
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000304">add</a>&nbsp;&nbsp;
      <a href="#M000301">after</a>&nbsp;&nbsp;
      <a href="#M000302">append_after</a>&nbsp;&nbsp;
      <a href="#M000298">append_before</a>&nbsp;&nbsp;
      <a href="#M000299">before</a>&nbsp;&nbsp;
      <a href="#M000300">prepend_after</a>&nbsp;&nbsp;
      <a href="#M000297">prepend_before</a>&nbsp;&nbsp;
      <a href="#M000305">remove_after</a>&nbsp;&nbsp;
      <a href="#M000303">scope_and_options</a>&nbsp;&nbsp;
      <a href="#M000306">setup</a>&nbsp;&nbsp;
      <a href="#M000307">teardown</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000304" class="method-detail">
        <a name="M000304"></a>

        <div class="method-heading">
          <a href="#M000304" class="method-signature">
          <span class="method-name">add</span><span class="method-args">(scope, options, where, how, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000304-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000304-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/dsl/behaviour_callbacks.rb, line 30</span>
30:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add</span>(<span class="ruby-identifier">scope</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">where</span>, <span class="ruby-identifier">how</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
31:         <span class="ruby-identifier">scope</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">:each</span>
32:         <span class="ruby-identifier">options</span> <span class="ruby-operator">||=</span> {}
33:         <span class="ruby-identifier">behaviour_type</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:behaviour_type</span>]
34:         <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">scope</span>
35:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:each</span>; <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-node">&quot;#{where}_each_parts&quot;</span>, <span class="ruby-identifier">behaviour_type</span>).<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">how</span>, <span class="ruby-identifier">block</span>)
36:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:all</span>;  <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-node">&quot;#{where}_all_parts&quot;</span>, <span class="ruby-identifier">behaviour_type</span>).<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">how</span>, <span class="ruby-identifier">block</span>)
37:         <span class="ruby-keyword kw">end</span>
38:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000301" class="method-detail">
        <a name="M000301"></a>

        <div class="method-heading">
          <span class="method-name">after</span><span class="method-args">(*args, &amp;block)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="BehaviourCallbacks.html#M000300">prepend_after</a>
</p>
        </div>
      </div>

      <div id="method-M000302" class="method-detail">
        <a name="M000302"></a>

        <div class="method-heading">
          <a href="#M000302" class="method-signature">
          <span class="method-name">append_after</span><span class="method-args">(*args, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000302-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000302-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/dsl/behaviour_callbacks.rb, line 20</span>
20:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">append_after</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
21:         <span class="ruby-identifier">scope</span>, <span class="ruby-identifier">options</span> = <span class="ruby-identifier">scope_and_options</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
22:         <span class="ruby-identifier">add</span>(<span class="ruby-identifier">scope</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">:after</span>, <span class="ruby-identifier">:&lt;&lt;</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
23:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000298" class="method-detail">
        <a name="M000298"></a>

        <div class="method-heading">
          <a href="#M000298" class="method-signature">
          <span class="method-name">append_before</span><span class="method-args">(*args, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000298-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000298-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/dsl/behaviour_callbacks.rb, line 9</span>
 9:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">append_before</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
10:         <span class="ruby-identifier">scope</span>, <span class="ruby-identifier">options</span> = <span class="ruby-identifier">scope_and_options</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
11:         <span class="ruby-identifier">add</span>(<span class="ruby-identifier">scope</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">:before</span>, <span class="ruby-identifier">:&lt;&lt;</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
12:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000299" class="method-detail">
        <a name="M000299"></a>

        <div class="method-heading">
          <span class="method-name">before</span><span class="method-args">(*args, &amp;block)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="BehaviourCallbacks.html#M000298">append_before</a>
</p>
        </div>
      </div>

      <div id="method-M000300" class="method-detail">
        <a name="M000300"></a>

        <div class="method-heading">
          <a href="#M000300" class="method-signature">
          <span class="method-name">prepend_after</span><span class="method-args">(*args, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000300-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000300-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/dsl/behaviour_callbacks.rb, line 15</span>
15:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">prepend_after</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
16:         <span class="ruby-identifier">scope</span>, <span class="ruby-identifier">options</span> = <span class="ruby-identifier">scope_and_options</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
17:         <span class="ruby-identifier">add</span>(<span class="ruby-identifier">scope</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">:after</span>, <span class="ruby-identifier">:unshift</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
18:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000297" class="method-detail">
        <a name="M000297"></a>

        <div class="method-heading">
          <a href="#M000297" class="method-signature">
          <span class="method-name">prepend_before</span><span class="method-args">(*args, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000297-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000297-source">
<pre>
   <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/dsl/behaviour_callbacks.rb, line 5</span>
5:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">prepend_before</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
6:         <span class="ruby-identifier">scope</span>, <span class="ruby-identifier">options</span> = <span class="ruby-identifier">scope_and_options</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
7:         <span class="ruby-identifier">add</span>(<span class="ruby-identifier">scope</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">:before</span>, <span class="ruby-identifier">:unshift</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
8:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000305" class="method-detail">
        <a name="M000305"></a>

        <div class="method-heading">
          <a href="#M000305" class="method-signature">
          <span class="method-name">remove_after</span><span class="method-args">(scope, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000305-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000305-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/dsl/behaviour_callbacks.rb, line 40</span>
40:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_after</span>(<span class="ruby-identifier">scope</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
41:         <span class="ruby-identifier">after_each_parts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">block</span>)
42:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000303" class="method-detail">
        <a name="M000303"></a>

        <div class="method-heading">
          <a href="#M000303" class="method-signature">
          <span class="method-name">scope_and_options</span><span class="method-args">(*args)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000303-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000303-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/dsl/behaviour_callbacks.rb, line 25</span>
25:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">scope_and_options</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
26:         <span class="ruby-identifier">args</span>, <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args_and_options</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
27:         <span class="ruby-identifier">scope</span> = (<span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">:each</span>), <span class="ruby-identifier">options</span>
28:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000306" class="method-detail">
        <a name="M000306"></a>

        <div class="method-heading">
          <a href="#M000306" class="method-signature">
          <span class="method-name">setup</span><span class="method-args">(&amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Deprecated. Use <a href="BehaviourCallbacks.html#M000299">before</a>(:each)
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000306-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000306-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/dsl/behaviour_callbacks.rb, line 45</span>
45:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
46:         <span class="ruby-identifier">before</span>(<span class="ruby-identifier">:each</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
47:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000307" class="method-detail">
        <a name="M000307"></a>

        <div class="method-heading">
          <a href="#M000307" class="method-signature">
          <span class="method-name">teardown</span><span class="method-args">(&amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Deprecated. Use <a href="BehaviourCallbacks.html#M000301">after</a>(:each)
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000307-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000307-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/dsl/behaviour_callbacks.rb, line 50</span>
50:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">teardown</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
51:         <span class="ruby-identifier">after</span>(<span class="ruby-identifier">:each</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
52:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>